All Questions
Tagged with entity-frameworkdomain-driven-design
29 questions
-1votes
3answers
2kviews
How to properly design database in accordance with DDD
My Domain layer contains below model: public class ApiResource { public bool Enabled { get; set; } = true; public string Name { get; set; } public string ClientId { get; set; } public ...
0votes
1answer
3kviews
Doubt about DDD, entity core and backing field
I was reading the documentation about how to use Entity Core in a DDD way. This is the documentation. It is said that I can configure EF to can map an internal private field to a private field, the ...
4votes
1answer
1kviews
Posts and Comments - how should I define them in domain driven design?
I am designing a blog in domain driven design. I don't know how I should define models: Post and Comment. My database: A user can see a post and related comments. So I think that Post model can be ...
1vote
1answer
228views
Does injecting ILazyLoader inside entities in EF contradicts separation of concerns in design?
Microsoft suggests to inject ILazyLoader service inside entities in order to enable lazy loading manually in EF: https://docs.microsoft.com/en-us/ef/core/querying/related-data/lazy#lazy-loading-...
1vote
2answers
1kviews
Should an AggregateRoot not be a database Entity?
TLDR: Does using DB objects as my AggregateRoot lead to bloated God objects. In comparison to the issues I see in using separate DbObjects and DDD objects. I'm trying to bring together my ...
0votes
2answers
959views
Entity Framework and Domain Driven Design Testability
I'm using a DDD approach for the Domain classes. Although, I have a problem on my design, that I'm handling it now but didn't have a good idea to over tackle it. My Architecture is the follow one: - ...
8votes
2answers
8kviews
Avoiding Repository pattern - implementing Onion Architecture with DbContext only
I am trying to follow the Onion Architecture to design my application where I have the following layers - Domain Layer: is the inner-most layer and defines repository interfaces Infrastructure Layer:...
2votes
2answers
275views
Different types of account transactions
I'm working on a system where users have different types of 'Accounts' of the financial type. I'm struggling to come up with a design that works. Background A user has 2 types of accounts: A 'tab' ...
4votes
3answers
3kviews
DataAccess Layer coupling with Domain Layer
We have an issue with how the implementation of the Data Access layer (EF6 Includes more specifically), influences the behavior of our Domain layer. A theoretical example to illustrate: Application ...
0votes
2answers
623views
Is a refresh token an entity or value object?
I have a User entity, which may have a RefreshToken (for authentication). Notes: A refresh token doesn't have "identity", but is related to a single user - it is only valid for that user. In the db ...
5votes
3answers
404views
Is a repository return a graph of entities violating SRP?
I'm working in this scenario Post entity has many Image entities. I also have repository to both entities: PostRepository ImageRepository Since this entities are tightly related, when I get a Post I ...
-1votes
1answer
236views
Patterns for loading related objects in memory (without an ORM)
I am using ADO.NET to read a bunch of data from the database into in-memory objects. This is my domain model: // Question.cs public class Question { public int ID { get; set; } public ...
31votes
5answers
12kviews
Pitfalls of Domain Driven Design with Entity Framework
A lot of tutorials on DDD I studied are mostly covering theory. They all have rudimentary code examples (Pluralsight and similar). On the web there are also attempts by a few people to create ...
10votes
2answers
10kviews
Separating Domain Object and Data Models
I looked through a lot of articles, blogs, and SO topics about separating domain object and data models. Almost every answer said: You should have separate classes for the domain and data persistence, ...
-2votes
1answer
365views
Role-based declarative security for C#
According to Domain Driven Design and Development In Practice: Spring Security (a sub-project in Spring Portfolio) provides a fine-grained access control in both presentation (URL based) and ...